package io.output;

import org.junit.Test;
import java.io.FileOutputStream;
import java.io.Writer;
import java.nio.charset.StandardCharsets;

/**
 * @author mubei
 * @date 2021/12/3
 * @description
 */
public class FIleOutputStream_ {


    



    @Test()
    public void Test1() {
        String filepath = "D:\\date\\distable\\practice\\code\\basic\\src\\main\\java\\io\\a.txt";

        FileOutputStream fileOutputStream =null;

        try {
            fileOutputStream = new FileOutputStream(filepath);
            // 文件追加
            //fileOutputStream = new FileOutputStream(filepath,true);
            /*
            * write()  有三种输入参数
            * */
            fileOutputStream.write("ah真漂亮".getBytes(StandardCharsets.UTF_8));
        } catch (Exception e) {
            e.printStackTrace();
        }finally {
            try {
                fileOutputStream.close();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }


    }
}
